package com.bwie.parkdemo.mvvm.model.entity;

import com.bwie.lib_core.base.BaseEntity;
import com.google.gson.Gson;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.util.ArrayList;
import java.util.List;

/**
 * 维修人员实体类
 * */
public class RepairUserEntity extends BaseEntity{

    private String values;
    private List<Object>datas;

    public void setValues(String values) {
        this.values = values;
    }

    public List<Object> getDatas() {
        datas = new ArrayList<>();
        try {
            JSONArray jay = new JSONArray(values);
            for (int i = 0;i < jay.length();i ++){
                String jsonStr = jay.getJSONObject(i).toString();
                Values entity = new Gson().fromJson(jsonStr,Values.class);
                datas.add(entity);
            }
        } catch (JSONException e) {
            e.printStackTrace();
        }
        return datas;
    }

    /**
     * {\"dept_id\":0,\"pId\":0,\"time\":\"1583481383\",
     * \"token\":\"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhdWQiOiI0NyIsImV4cCI6MzE2Njk2Mjc2OSwiaWF0IjoxNTgzNDgxMzg0fQ.W5-fiRpnEXpcEcXMbbAWK1WlNRkEZhqE0hlEEhZwX6g\",
     * \"uId\":47,\"uName\":\"jyc\",\"uPwd\":\"123456\"}
     * */
    public static class Values{
        public long dept_id;
        public long pId;
        public String time;
        public long uId;
        public String uName;
        public boolean isSel = false;//是否选择该用户标志
    }
}
